<%@ Control Language="C#" Inherits="SoftwareMonkeys.Scriptech.Web.BaseScript" %>
<%@ Import namespace="SoftwareMonkeys.Scriptech.Configuration" %>
<%@ Import namespace="SoftwareMonkeys.Scriptech.Projects" %>
<%@ Import namespace="SoftwareMonkeys.Scriptech.Web" %>
<%@ Import namespace="SoftwareMonkeys.Scriptech.Business" %>
<%@ Import namespace="SoftwareMonkeys.Scriptech.Ftp" %>
<%@ Import namespace="System.IO" %>
<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
}

private void CreateButton_Click(object sender, EventArgs e)
{
	FtpServer ftpServer = CreateStrategy.New<FtpServer>().Create<FtpServer>();

	ftpServer.Name = Name.Text;
	ftpServer.Address = Address.Text;
	ftpServer.Username = Username.Text;
	ftpServer.Password = Password.Text;
	ftpServer.RemoteDirectory = RemoteDirectory.Text;

	SaveStrategy.New(ftpServer).Save(ftpServer);

	Response.Redirect(ScriptPath.GetUrl("FtpServerIndex.ascx"));

}
</script>
	<h1>Create FTP</h1>
<hr/>
<div><a href='<%= Request.ApplicationPath %>'>Home</a> - <a href='<%= ScriptPath.GetUrl("FtpServers.ascx") %>'>FTP Servers</a></div>
<hr/>
	<table width="100%">
		<tr>
			<td>Name:</td>
			<td>
				<asp:textbox runat="server" id="Name" width="400px" text="newftpserver"/></td>
		</tr>
		<tr>
			<td>Address:</td>
			<td>
				<asp:textbox runat="server" id="Address" width="400px" text="ftp.server.com"/></td>
		</tr>
		<tr>
			<td>Username:</td>
			<td>
				<asp:textbox runat="server" id="Username" width="400px" text="user"/></td>
		</tr>
		<tr>
			<td>Password:</td>
			<td>
				<asp:textbox runat="server" id="Password" width="400px" text="pass"/></td>
		</tr>
		<tr>
			<td>Remote directory:</td>
			<td>
				<asp:textbox runat="server" id="RemoteDirectory" width="400px" text="/"/></td>
		</tr>
		<tr>
			<td> </td>
			<td>
				<asp:button runat="server" id="CreateButton" text="Create" onclick="CreateButton_Click"/>
			</td>
		</tr>
	</table>